#if !defined(_PROGRAM_H_)
#define _PROGRAM_H_

#include <stdlib.h>
#include <string>

class program
{
  public:
	program();
	~program();
	
	bool init_from_buffer(const char *_buffer, size_t _size);
	bool init_from_string(const std::string &_buffer);
	bool init_from_base64(const std::string &_buffer);
	
	void reset();
	
	unsigned int get_offs();

	bool eof();
	
	void get_next_chunk(char *_buffer, size_t _size, size_t &_real_size, bool _repeat = false);
	
  private:	
  
	char *buffer_;
	size_t size_;
	size_t offs_;
	size_t last_offs_;
	bool eof_;
};

#endif
